home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 January / macformat46.iso / Shareware Plus / Developers / EnterAct / EnterAct Stuff / Drag_on Modules / hAWK programs / $LineCount < prev    next >
Encoding:
Text File  |  1992-05-24  |  358 b   |  23 lines

  1. #$LineCount: get lines in each input file, and total up at the end
  2. #Use MFS input option, and show stdout.
  3.  
  4. FNR == 1{
  5.     if (count+0 > 0)
  6.         {
  7.         print names[n] ":", count
  8.         total += count
  9.         count = 0
  10.         }
  11.     n = split(FILENAME, names, ":")
  12.     }
  13.  
  14.     {++count}
  15.  
  16. END {
  17.     if (count+0 > 0)
  18.         {
  19.         print names[n] ":", count
  20.         total += count
  21.         }
  22.     print "Total lines:", total
  23.     }